package ro.ubbcluj.cs.damate.persistence.repository;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import ro.ubbcluj.cs.damate.persistence.entities.User;
import ro.ubbcluj.cs.damate.persistence.entities.Workspace;

import java.util.List;

/**
 * @author Lóránd Fazakas (lorand)
 *         Date: 5/10/12
 *         Time: 9:25 PM
 */
public interface WorkspaceRepository extends CrudRepository<Workspace, Long> {

    List<Workspace> findByIpAddressAndPath(String ip, String path);
    @Query("select w from Workspace w where w.owner = ?1 and w.ipAddress = ?2")
    List<Workspace> findByUserAndIp(User user, String ip);
}
